Dim $UITable1$ As UITable
$UITable1$.Initialize(Me, "$UITable1$")
$UITable1$.AddToView(Activity, 10dip, 10dip, 300dip, 200dip)
$UITable1$.AddColumns(Array As String("ID", "Name", "Score"))
$UITable1$.AddRow(Array As String("1", "John Doe", "95"))
$UITable1$.AddRow(Array As String("2", "Jane Smith", "88"))
' Append a column; existing rows receive an empty value in that column.
$UITable1$.AddColumns(Array As String("Status"))
' Add a blank row with one cell per current column.
$UITable1$.AddEmptyRow
' Optional: put an icon beside a column title and an image beside cell text.
Dim statusImage As Bitmap = LoadBitmap(File.DirAssets, "status.png")
$UITable1$.SetHeaderImage(2, statusImage, 20dip, 20dip)
$UITable1$.SetCellImage(0, 0, statusImage, 22dip, 22dip)
' A cell may also host multiple controls; create each control with its own ElevateUI class.
Dim cellButton As UIButton
cellButton.Initialize(Me, "CellButton")
Dim cellHost As B4XView = $UITable1$.GetCellContentPanel(2, 0)
cellButton.AddToParent(cellHost, 3dip, 3dip, 80dip, 24dip, cellButton.STYLE_OUTLINED, 12, "Open", Colors.White, 0xFF168F86, 5)
' Remove a data row by its zero-based index.
$UITable1$.DeleteRow(0)
' Select and scroll a cell into view (zero-based column and row indexes).
$UITable1$.SelectCell(1, 0)
' Optional: handle a dragged fill range. Without this handler the table copies it automatically.
Private Sub $UITable1$_FillRange(Fill As UITableFillRange)
	Dim copiedValue As String = $UITable1$.GetValue(Fill.SourceCol, Fill.SourceRow)
	For rowIndex = Min(Fill.SourceRow, Fill.TargetRow) To Max(Fill.SourceRow, Fill.TargetRow)
		For colIndex = Min(Fill.SourceCol, Fill.TargetCol) To Max(Fill.SourceCol, Fill.TargetCol)
			If colIndex = Fill.SourceCol And rowIndex = Fill.SourceRow Then Continue
			$UITable1$.SetValue(colIndex, rowIndex, copiedValue)
		Next
	Next
End Sub
Private Sub CellButton_Click
	Log("Cell button clicked")
End Sub
$end$
